package com.zmh.wuye.controller;

import com.zmh.wuye.dao.ContractMapper;
import com.zmh.wuye.entity.Contract;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin
@RestController
public class ContractController {
    @Autowired
    private ContractMapper contractMapper;
    @RequestMapping("/selectContractList")
    public List<Contract> selectContractList(Contract contract) {
        List<Contract> contracts = contractMapper.selectContractList(contract);
        return contracts;
    }
    @RequestMapping("/getCount")
    public int getCount(Contract contract) {
        int count = contractMapper.getCount(contract);
        return count;
    }
    /********************/
    @RequestMapping("/addContract")
    public void addContract(Contract contract){
        contractMapper.addContract(contract);
    }
    @RequestMapping("/updateContract")
    public void updateContract(Contract contract){
        contractMapper.updateConttract(contract);
    }
    @RequestMapping("/deleteContract")
    public void deleteContract(int cid){
        contractMapper.deleteContract(cid);
    }
}
